﻿<phone:PhoneApplicationPage x:Class="OnlineVideos.DownloadList"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:AdRotator="clr-namespace:AdRotator;assembly=AdRotator"
        xmlns:inputtoolkit="clr-namespace:MarkHeath.StarRating;assembly=MarkHeath.StarRating"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"

    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
     Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Landscape"
    shell:SystemTray.IsVisible="False"
    Loaded="PhoneApplicationPage_Loaded" >
    <Grid x:Name="LayoutRoot" Opacity="5" Background="{StaticResource bipivot}" >
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="80"/>
        </Grid.RowDefinitions>
        <!--LayoutRoot is the root grid where all page content is placed-->
        <Grid Background="Transparent" Grid.Row="0"  >
            <!--Pivot Control-->
            <phone:Pivot x:Name="pvtVideos" >
                <phone:Pivot.Title>
                    <StackPanel Orientation="Horizontal" Margin="-15,0,0,0">
                        <Image Style="{StaticResource DetailPagePivotTitleImage}" x:Name="imgTitle" MouseLeftButtonDown="imgTitle_MouseEnter"/>
                        <TextBlock x:Name="tblkVideosTitle" TextWrapping="NoWrap" Style="{StaticResource DetailPagePivotTitle}" />
                    </StackPanel>
                </phone:Pivot.Title>
                <phone:Pivot.Foreground>
                    white
                </phone:Pivot.Foreground>
                <phone:PivotItem  x:Name="pvtcat">
                    <Grid>
                        <ListBox x:Name="lbxCategory" Width="470" SelectionChanged="lbxCategory_SelectionChanged" >
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid Height="70">
                                        <StackPanel  Margin="15,0,0,0" Height="50">
                                            <TextBlock x:Name="tblkcategory" Text="{Binding CategoryName}" Style="{StaticResource tblkcategory}" TextWrapping="Wrap" Margin="10,0,0,0"></TextBlock>
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                        <TextBlock x:Name="tblknocat" HorizontalAlignment="Center" VerticalAlignment="Center" Text="no sites available" Visibility="Collapsed"></TextBlock>
                    </Grid>
                </phone:PivotItem>
                <!--Pivot item one-->
                <phone:PivotItem x:Name="pvttop" Header="top rated">
                    <Grid>
                        <ListBox x:Name="lbxTopRated" Width="470" SelectionChanged="lbxTopRated_SelectionChanged" Foreground="White">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid Height="200">
                                        <toolkit:ContextMenuService.ContextMenu>
                                            <toolkit:ContextMenu   Opened="ContextMenu_Opened_1">
                                                <toolkit:MenuItem x:Name="deletetoprated"   Header="delete"  Click="deletetoprated_Click">
                                                </toolkit:MenuItem>
                                                <toolkit:MenuItem x:Name="addtofav"   Header="add to favorites"  Click="addtofav_Click_1">
                                                </toolkit:MenuItem>
                                                <toolkit:MenuItem x:Name="renamevideo"   Header="rename title" Click="renamevideo_Click_1">
                                                </toolkit:MenuItem>
                                            </toolkit:ContextMenu>
                                        </toolkit:ContextMenuService.ContextMenu>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="115"/>
                                            <ColumnDefinition Width="350"/>
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>
                                        <Image Grid.Column="0" Grid.Row="0" x:Name="imgMovie" Source="{Binding Image}" VerticalAlignment="Top" Width="130" Height="170"  Visibility="{Binding Isvisible}" Stretch="UniformToFill"/>
                                        <StackPanel Grid.Column="1" Grid.Row="0" Margin="15,0,0,0" Height="210">
                                            <TextBlock Text="{Binding Title}" FontSize="24" FontWeight="Bold" Width="320" Height="40" TextTrimming="WordEllipsis" TextWrapping="Wrap" Margin="10,0,0,0"></TextBlock>
                                            <TextBlock Text="{Binding FileSize}" FontSize="22" Margin="0,0,0,0"  Visibility="{Binding FileSize, TargetNullValue=Collapsed}"></TextBlock>

                                            <!--<StackPanel Margin="10,10,0,0" Orientation="Horizontal">-->

                                                <!--<StackPanel x:Name="stkrate"></StackPanel>-->
                                                <!--<Image Width="139" Height="18" Source="{Binding RatingImage}" Visibility="{Binding Isvisible}"/>-->

                                                <!--<inputtoolkit:StarRatingControl Name="rate" Rating="{Binding Rating}" Tag="{Binding MovieId}" IsEnabled="False"  NumberOfStars="5" Height="25" Width="139" Visibility="{Binding Isvisible}" ></inputtoolkit:StarRatingControl>-->
                                                <!--<TextBlock Text="{Binding RelaseDate}" FontSize="22" Margin="0,0,0,0"  Visibility="{Binding Isvisible}"></TextBlock>
                                            </StackPanel>-->
                                            <!--<TextBlock Text="{Binding Genre}" FontSize="22" Margin="10,10,0,0" Visibility="{Binding GenreIsvisible}"></TextBlock>-->
                                            <!--<StackPanel Orientation="Horizontal"  Margin="10,10,0,0">
                                                <TextBlock  Style="{StaticResource Languagetext}" FontSize="22"  Visibility="{Binding SubTitle, TargetNullValue=Collapsed}"></TextBlock>
                                                <TextBlock Text="{Binding SubTitle}" FontSize="22" TextWrapping="Wrap" Visibility="{Binding Isvisible}"></TextBlock>
                                            </StackPanel>-->

                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                        <Canvas>
                            <TextBlock Canvas.Top="160" Canvas.Left="90" Foreground="White"  TextWrapping="Wrap" Width="450" FontSize="28" x:Name="tblkToprated" Visibility="Collapsed"/>
                        </Canvas>
                    </Grid>
                </phone:PivotItem>

                <!--Pivot item two-->
                <phone:PivotItem x:Name="pvtrecent" Header="recent">
                    <Grid>
                        <ListBox x:Name="lbxRecentlyAdded" Width="470" SelectionChanged="lbxRecentlyAdded_SelectionChanged" Foreground="White">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid Height="200">
                                        <toolkit:ContextMenuService.ContextMenu>
                                            <toolkit:ContextMenu  Opened="ContextMenu_Opened_2">
                                                <toolkit:MenuItem x:Name="deleterecent"  Header="delete"  Click="deleterecent_Click">
                                                </toolkit:MenuItem>
                                                <toolkit:MenuItem x:Name="addtofavrec"   Header="add to favorites"  Click="addtofavrec_Click_1">
                                                </toolkit:MenuItem>
                                                <toolkit:MenuItem x:Name="renamevideorecent"   Header="rename title" Click="renamevideorecent_Click_1">
                                                </toolkit:MenuItem>
                                            </toolkit:ContextMenu>
                                        </toolkit:ContextMenuService.ContextMenu>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="115"/>
                                            <ColumnDefinition Width="350"/>
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>
                                        <Image Grid.Column="0" Grid.Row="0" x:Name="imgMovie" Source="{Binding Image}" VerticalAlignment="Top" Width="130" Height="170" Stretch="UniformToFill"/>
                                        <StackPanel Grid.Column="1" Grid.Row="0" Margin="15,0,0,0" Height="210">
                                            <TextBlock Text="{Binding Title}" FontSize="24" FontWeight="Bold" Width="320" Height="40" TextTrimming="WordEllipsis" TextWrapping="Wrap" Margin="10,0,0,0"></TextBlock>
                                            <TextBlock Text="{Binding FileSize}" FontSize="22" Margin="0,0,0,0"  Visibility="{Binding FileSize, TargetNullValue=Collapsed}"></TextBlock>

                                            <!--<StackPanel Margin="10,10,0,0" Orientation="Horizontal">
                                                <Image Width="139" Height="18" Source="{Binding RatingImage}" Visibility="{Binding Isvisible}"/>
                                                <TextBlock Text="{Binding RelaseDate}" FontSize="22" Margin="70,0,0,0" Visibility="{Binding Isvisible}"></TextBlock>
                                            </StackPanel>
                                            <TextBlock Text="{Binding Genre}" FontSize="22" Margin="10,10,0,0" Visibility="{Binding GenreIsvisible}"></TextBlock>
                                            <StackPanel Orientation="Horizontal"  Margin="10,10,0,0">
                                                <TextBlock Style="{StaticResource Languagetext}" FontSize="22" Visibility="{Binding SubTitle, TargetNullValue=Collapsed}"></TextBlock>
                                                <TextBlock Text="{Binding SubTitle}" FontSize="22" TextWrapping="Wrap" Visibility="{Binding Isvisible}"></TextBlock>
                                            </StackPanel>-->
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                        <Canvas>
                            <TextBlock Canvas.Top="160" Canvas.Left="90" Foreground="White"  TextWrapping="Wrap" Width="450" FontSize="28" x:Name="tblkrecent" Visibility="Collapsed"/>
                        </Canvas>
                    </Grid>
                </phone:PivotItem>
                <phone:PivotItem Header="tamil"   x:Name="pvttamil" Visibility="Collapsed">
                    <Grid>
                        <ListBox x:Name="lbxTamilAdded" Width="470" SelectionChanged="lbxTamilAdded_SelectionChanged_1" Foreground="White">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid Height="200">
                                        <toolkit:ContextMenuService.ContextMenu>
                                            <toolkit:ContextMenu  Opened="ContextMenu_Opened_3">
                                                <toolkit:MenuItem x:Name="deletetamil"  Header="delete"  Click="deletetamil_Click_1">
                                                </toolkit:MenuItem>
                                            </toolkit:ContextMenu>
                                        </toolkit:ContextMenuService.ContextMenu>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="115"/>
                                            <ColumnDefinition Width="350"/>
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>
                                        <Image Grid.Column="0" Grid.Row="0" x:Name="imgMovie" Source="{Binding Image}" VerticalAlignment="Top" Width="100" Height="170"/>
                                        <StackPanel Grid.Column="1" Grid.Row="0" Margin="15,0,0,0" Height="210">
                                            <TextBlock Text="{Binding Title}" FontSize="24" FontWeight="Bold" Width="320" Height="40" TextTrimming="WordEllipsis" TextWrapping="Wrap" Margin="10,0,0,0"></TextBlock>
                                            <TextBlock Text="{Binding FileSize}" FontSize="22" Margin="0,0,0,0"  Visibility="{Binding FileSize, TargetNullValue=Collapsed}"></TextBlock>

                                            <StackPanel Margin="10,10,0,0" Orientation="Horizontal">
                                                <Image Width="139" Height="18" Source="{Binding RatingImage}" Visibility="{Binding Isvisible}"/>
                                                <TextBlock Text="{Binding RelaseDate}" FontSize="22" Margin="70,0,0,0" Visibility="{Binding Isvisible}"></TextBlock>
                                            </StackPanel>
                                            <TextBlock Text="{Binding Genre}" FontSize="22" Margin="10,10,0,0" Visibility="{Binding GenreIsvisible}"></TextBlock>
                                            <StackPanel Orientation="Horizontal"  Margin="10,10,0,0">
                                                <TextBlock Style="{StaticResource Languagetext}" FontSize="22" Visibility="{Binding SubTitle, TargetNullValue=Collapsed}"></TextBlock>
                                                <TextBlock Text="{Binding SubTitle}" FontSize="22" TextWrapping="Wrap" Visibility="{Binding Isvisible}"></TextBlock>
                                            </StackPanel>
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                        <!--<Canvas>
                            <TextBlock Canvas.Top="160" Canvas.Left="90" Foreground="White"  TextWrapping="Wrap" Width="450" FontSize="28" x:Name="tblktamil" Visibility="Collapsed"/>
                        </Canvas>-->
                    </Grid>
                </phone:PivotItem>
                <!--<phone:PivotItem Header="upcoming movies"  x:Name="pvtupcoming" Visibility="Collapsed">
                    <Grid>
                        <ListBox x:Name="lbxUpcomingAdded" Width="470" SelectionChanged="lbxUpcomingAdded_SelectionChanged_1" Foreground="White">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid Height="200">
                                        <toolkit:ContextMenuService.ContextMenu>
                                            <toolkit:ContextMenu  Opened="ContextMenu_Opened_4">
                                                <toolkit:MenuItem x:Name="deleteupcoming"  Header="delete"  Click="deleteupcoming_Click_1">
                                                </toolkit:MenuItem>
                                            </toolkit:ContextMenu>
                                        </toolkit:ContextMenuService.ContextMenu>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="115"/>
                                            <ColumnDefinition Width="350"/>
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>
                                        <Image Grid.Column="0" Grid.Row="0" x:Name="imgMovie" Source="{Binding Image}" VerticalAlignment="Top" Width="100" Height="170"/>
                                        <StackPanel Grid.Column="1" Grid.Row="0" Margin="15,0,0,0" Height="210">
                                            <TextBlock Text="{Binding Title}" FontSize="24" FontWeight="Bold" Width="320" Height="40" TextTrimming="WordEllipsis" TextWrapping="Wrap" Margin="10,0,0,0"></TextBlock>
                                            <TextBlock Text="{Binding FileSize}" FontSize="22" Margin="0,0,0,0"  Visibility="{Binding FileSize, TargetNullValue=Collapsed}"></TextBlock>

                                            <StackPanel Margin="10,10,0,0" Orientation="Horizontal">
                                                <Image Width="139" Height="18" Source="{Binding RatingImage}" Visibility="{Binding Isvisible}"/>
                                                <TextBlock Text="{Binding RelaseDate}" FontSize="22" Margin="70,0,0,0" Visibility="{Binding Isvisible}"></TextBlock>
                                            </StackPanel>
                                            <TextBlock Text="{Binding Genre}" FontSize="22" Margin="10,10,0,0" Visibility="{Binding GenreIsvisible}"></TextBlock>
                                            <StackPanel Orientation="Horizontal"  Margin="10,10,0,0">
                                                <TextBlock Style="{StaticResource Languagetext}" FontSize="22" Visibility="{Binding SubTitle, TargetNullValue=Collapsed}"></TextBlock>
                                                <TextBlock Text="{Binding SubTitle}" FontSize="22" TextWrapping="Wrap" Visibility="{Binding Isvisible}"></TextBlock>
                                            </StackPanel>
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                        <Canvas>
                            <TextBlock Canvas.Top="160" Canvas.Left="90" Foreground="White"  TextWrapping="Wrap" Width="450" FontSize="28" x:Name="tblkrecent" Visibility="Collapsed"/>
                        </Canvas>
                    </Grid>
                </phone:PivotItem>-->
                <phone:PivotItem x:Name="pvtdownload" Visibility="Collapsed">
                    <Grid Name="downloadGrid">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto"></RowDefinition>
                                <RowDefinition Height="*"></RowDefinition>
                            </Grid.RowDefinitions>
                            <ListBox x:Name="lbxdownloading" Grid.Row="0"  Width="470"  Foreground="White" SelectionChanged="lbxdownloading_SelectionChanged_1">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <Grid Background="Transparent" Margin="0,0,0,30">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="380"/>
                                                <ColumnDefinition Width="50"/>
                                            </Grid.ColumnDefinitions>
                                            <Grid Grid.Column="0">

                                                <StackPanel Orientation="Vertical">
                                                    <TextBlock Text="{Binding Title}"  Foreground="White"  FontWeight="Bold"/>

                                                    <!--<StackPanel Orientation="Horizontal">
                                                <TextBlock Text="status: "/>
                                                <TextBlock Text="{Binding TransferStatus}" HorizontalAlignment="Right"/>
                                            </StackPanel>-->

                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBlock Text="Status: "/>
                                                        <ProgressBar x:Name="MyProgressBar" Value="{Binding ChapterProgressPosition}"  
                                                 IsIndeterminate="False"  Width="150"  Background="Black" Foreground="Red" HorizontalAlignment="Right">
                                                        </ProgressBar>
                                                        <TextBlock x:Name="CancelDownload" Text="Cancel" FontSize="24" Margin="10,0,0,0" Tap="CancelDownload_Tap_1"/>
                                                    </StackPanel>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBlock Text="total bytes: "/>
                                                        <TextBlock Text="{Binding TotalBytesToRecieve}" HorizontalAlignment="Right"/>
                                                    </StackPanel>
                                                </StackPanel>

                                            </Grid>
                                            <Grid Grid.Column="1">
                                                <Image x:Name="img1" Source="{Binding RequestUri}" Width="80" Height="80"></Image>
                                            </Grid>
                                        </Grid>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                            <Canvas>
                                <TextBlock Text="No current downloads" Canvas.Top="200" Canvas.Left="80" FontSize="28" x:Name="tblkNoDownloads" Visibility="Collapsed"/>
                            </Canvas>
                        </Grid>
                    </Grid>
                </phone:PivotItem>

            </phone:Pivot>
            <toolkit:PerformanceProgressBar
            VerticalAlignment="Top"
            x:Name="performanceProgressBar"/>
        </Grid>
        <StackPanel Name="adstackpl" Grid.Row="1" Background="Black" Orientation="Vertical" Margin="-12,0,-10,-4"  >
        </StackPanel>
    </Grid>
    <phone:PhoneApplicationPage.ApplicationBar >

        <shell:ApplicationBar x:Name="appbar"  IsVisible="True" IsMenuEnabled="False">

            <shell:ApplicationBarIconButton x:Name="btnadd" IconUri="/Images/appbar.add.rest.png" Text="Add" Click="btnadd_Click_1"/>

        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>